package org.elanfox.cloud.mybatis.constant;

import java.util.HashMap;
import java.util.Map;

public class JavaToMysqlType {
    public static Map<String, MysqlTypeConstant> javaToMysqlTypeMap = new HashMap<>();

    static {
        javaToMysqlTypeMap.put("class java.lang.String", MysqlTypeConstant.VARCHAR);
        javaToMysqlTypeMap.put("class java.lang.Long", MysqlTypeConstant.BIGINT);
        javaToMysqlTypeMap.put("class java.lang.Integer", MysqlTypeConstant.INT);
        javaToMysqlTypeMap.put("class java.lang.Boolean", MysqlTypeConstant.BIT);
        javaToMysqlTypeMap.put("class java.math.BigInteger", MysqlTypeConstant.BIGINT);
        javaToMysqlTypeMap.put("class java.lang.Float", MysqlTypeConstant.FLOAT);
        javaToMysqlTypeMap.put("class java.lang.Double", MysqlTypeConstant.DOUBLE);
        javaToMysqlTypeMap.put("class java.lang.Short", MysqlTypeConstant.SMALLINT);
        javaToMysqlTypeMap.put("class java.math.BigDecimal", MysqlTypeConstant.DECIMAL);
        javaToMysqlTypeMap.put("class java.sql.Date", MysqlTypeConstant.DATETIME);
        javaToMysqlTypeMap.put("class java.util.Date", MysqlTypeConstant.DATETIME);
        javaToMysqlTypeMap.put("class java.sql.Timestamp", MysqlTypeConstant.TIMESTAMP);
        javaToMysqlTypeMap.put("class java.sql.Time", MysqlTypeConstant.TIME);
        javaToMysqlTypeMap.put("class java.time.LocalDateTime", MysqlTypeConstant.DATETIME);
        javaToMysqlTypeMap.put("class java.time.LocalDate", MysqlTypeConstant.DATE);
        javaToMysqlTypeMap.put("class java.time.LocalTime", MysqlTypeConstant.TIME);
        javaToMysqlTypeMap.put("long", MysqlTypeConstant.BIGINT);
        javaToMysqlTypeMap.put("int", MysqlTypeConstant.INT);
        javaToMysqlTypeMap.put("boolean", MysqlTypeConstant.BIT);
        javaToMysqlTypeMap.put("float", MysqlTypeConstant.FLOAT);
        javaToMysqlTypeMap.put("double", MysqlTypeConstant.DOUBLE);
        javaToMysqlTypeMap.put("short", MysqlTypeConstant.SMALLINT);
        javaToMysqlTypeMap.put("char", MysqlTypeConstant.VARCHAR);
    }
}
